package com.anlu.base.reflection;

import com.anlu.base.reflection.model.ReturnTypeClass;

import java.lang.reflect.*;

public class Maintest {
    public static void main(String[] args) {
        Method[] declaredMethods = ReturnTypeClass.class.getDeclaredMethods();

        for (Method declaredMethod : declaredMethods) {
            //破坏私有性
            declaredMethod.setAccessible(true);
            //获取方法的返回值
            Type genericReturnType = declaredMethod.getGenericReturnType();

//            System.out.println("方法名称 : "+declaredMethod.getName()+ "放回值类型是否是TypeVariable类型  :  " +(genericReturnType instanceof TypeVariable));

//            System.out.println("方法名称 : "+declaredMethod.getName()+ "放回值类型是否是TypeVariable类型  :  " +(genericReturnType instanceof ParameterizedType));

            System.out.println("方法名称 : "+declaredMethod.getName()+ "放回值类型是否是TypeVariable类型  :  " +(genericReturnType instanceof GenericArrayType));

        }
    }
}
